<template>
	<view class="kingKongarea">
		<view class="blocks_box">
			<view class="blocks_box_once" v-for="(item, index) in blocks" :key="item.id" @click="gopages(item)">
				<image class="icon" :src="item.icon" mode=""></image>
				<view class="txt">{{ item.txt }}</view>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	name: "kingKongArea",
	data() {
		return {
			blocks: [{
				// icon: 'https://hxc-pay.oss-cn-shenzhen.aliyuncs.com/mSWGpLeFnx_mymoney_icon.png',
				icon: 'https://hxc-pay.oss-cn-shenzhen.aliyuncs.com/McDrTynAPs_logo_direct.png',
				txt: '我的交易',
				url: '/pages/main/myDirect',
				id: 2
			},
			{
				// icon: 'https://hxc-pay.oss-cn-shenzhen.aliyuncs.com/mSWGpLeFnx_mymoney_icon.png',
				icon: 'https://wanxian-test.oss-cn-shenzhen.aliyuncs.com/%E7%AD%BE%E5%88%B0.png',
				txt: '签到',
				url: '/activePages/pages/sign_in/sign_in',
				id: 3
			},
			{
				// icon: 'https://hxc-pay.oss-cn-shenzhen.aliyuncs.com/mSWGpLeFnx_mymoney_icon.png',
				icon: 'https://wanxian-test.oss-cn-shenzhen.aliyuncs.com/%E7%AD%BE%E5%88%B0.png',
				txt: '我的余额',
				url: '/pages/main/myWallet',
				id: 4
			},
			// {
			// 	icon: 'https://hxc-pay.oss-cn-shenzhen.aliyuncs.com/DHRgxmZQul_jiju_icon.png',
			// 	url: '/pages/main/myMachine',
			// 	txt: '我的机具',
			// 	id: 4
			// }, {
			// 	icon: 'https://hxc-pay.oss-cn-shenzhen.aliyuncs.com/TQQMxVVqBk_parten_icon.png',
			// 	url: '/pages/main/myPartner',
			// 	txt: '我的伙伴',
			// 	id: 6
			// }
			]

		};
	},
	mounted() {
		let role=uni.getStorageSync('role');
		console.log("当前登录角色:"+role)
		if(role==0){
			var terminal=
				{
					icon: 'https://hxc-pay.oss-cn-shenzhen.aliyuncs.com/VrnimpyzFl_my_zhongdan_icon.png',
					url: '/pages/main/myTerminal',
					txt: '终端管理',
					id: 3
				};
			this.blocks.push(terminal)
		}
		if(role==1){
			var terminal=
				{
					icon: 'https://hxc-pay.oss-cn-shenzhen.aliyuncs.com/VrnimpyzFl_my_zhongdan_icon.png',
					url: '/pages/main/myTerminal',
					txt: '终端管理',
					id: 3
				};
			this.blocks.push(terminal)
		}
	},
	methods: {
		gopages(item) {
			if (item.id === 2 || item.id === 3 || item.id === 4 || item.id === 6) {
				uni.navigateTo({
					url: item.url
				})
			}
		}
	}
}
</script>

<style lang="scss" scoped>
.kingKongarea {
	
	background-color: #fff;
	border-radius: 16rpx;
	padding-top: 20rpx;
	margin-top: -20rpx;
	margin-left: 30rpx;
	margin-right: 30rpx;

	.blocks_box {
		width: 100%;
		// height: 320rpx;
		display: flex;
		align-content: center;
		// justify-content: space-between;
		flex-wrap: wrap;

		.blocks_box_once {
			width: 25%;
			height: 160rpx;
			text-align: center;

			.icon {
				width: 90rpx;
				height: 90rpx;
			}

			.txt {
				width: 100%;
				font-size: 26rpx;
				font-weight: 400;
				color: #4d4d4d;
				line-height: 44rpx;
			}
		}
	}
}
</style>
